/**
 * description：发送请求，对请求统一行为封装，并抛出独立处理事件
 * author：
 * */

import axios from './axios';
import Vue from 'vue';
function httpHandler(method = 'post', url = '', params = {}, options = {}) {
    const _this = Vue;
    return axios[method.toLowerCase()](url, params).then(data => {

        return data;
    }).catch(err => {

        return Promise.reject(err);
    });
}

export default {
    get(url, params, options) {
        return httpHandler('get', url, {params}, options);
    },
    delete(url, params, options) {
        return httpHandler('delete', url, {params}, options);
    },
    post(url, params, options) {
        return httpHandler('post', url, params, options);
    }
};
